﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="RGMTypePage.aspx.cs" Inherits="FBKPI.Pages.RGMTypePage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            mainmenu("#nav ul", "#nav li");
            mainmenu("#menu_wrap ul", "#menu_wrap li");
            $("#divdetail").hide();
            $("#divdetail").dialog({
                title: '<span class="header-text">RGM Type Form</span>',
                autoOpen: false,
                width: 400,
                height: 400,
                modal: true,
                resizable: false
            });

            //datatable section
            $("#RGMTypeTable").dataTable({
                "oLanguage": {
                    "sZeroRecords": "No records to display",
                    "sSearch": "Search"
                },
                "bSort": true,
                "bPaginate": true,
                "bAutoWidth": false,
                "bProcessing": true,
                "bServerSide": true,
                "bDestroy": true,
                "bJQueryUI": true,
                "sPaginationType": "full_numbers",
                "bDeferRender": true,
                "fnServerData": function (sSource, aoData, fnCallback) {
                    $.ajax({
                        "dataType": 'json',
                        "type": "GET",
                        "url": "../Serializer/RGMTypeSerializer.ashx",
                        "data": aoData,
                        "success": fnCallback
                    });
                },
                "aoColumns": [
            {
                "mData": "ID"
            }, {
                "mData": "No"
            }, {
                "mData": "Description"
            }, {
                "mData": "isNationWide"
            }, {
                "mData": "isActive"
            }, {
                "mData": "LastModifiedDate"
            }, {
                "mData": "LastModifiedBy"
            }, {
                "mData": "CreateDate"
            }, {
                "mData": "CreateBy"
            }, ],
                "aoColumnDefs": [{
                    "fnRender": function (oObj) {
                        return "<a href=\"#\" onclick=\"OnDetail('" + oObj.aData["ID"] + "')\"><img src='../images/detail.png' /></a>";
                    },
                    "aTargets": [0]
                }, {
                    "fnRender": function (oObj) {
                        if (oObj.aData["isNationWide"] == 'True') {
                            return "<img src='../images/check.png' />"
                        } else {
                            return "<img src='../images/cross.png' />"
                        }
                    },
                    "aTargets": [2]
                }, {
                    "fnRender": function (oObj) {
                        if (oObj.aData["isActive"] == 'True') {
                            return "<img src='../images/check.png' />"
                        } else {
                            return "<img src='../images/cross.png' />"
                        }
                    },
                    "aTargets": [3]
                }, {
                    "sClass": "center",
                    "aTargets": [0, 2, 3, 4, 5, 6, 7, 8]
                }]
            });

            //mark selected row
            $('body').on("click", '#RGMTypeTable tbody tr', function () {
                $('#RGMTypeTable tbody tr').removeClass("row_selected");
                $(this).addClass("row_selected");
            });
            //--------------------end of mark selected row-----------------------------
            $("#RGMTypeTable_filter label").after('&nbsp;<button id=\"btnAddNew\" style="right: 0px;" onclick=\'OnDetail(0);return false;\'>New Record</button>');
            //--------------------end of datatable section-----------------------------------------

            OnDetail = function (code) {
                LoadForm('RGMTypeForm.aspx?ID=' + code, function (result) {
                    $("#divdetail").html(result);
                    $("#divdetail").dialog('open');
                });
                return false;
            }
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="height:525px;overflow:auto;" >
    <div id="rgmtypetable">
        <div>
            <div class="customPageHeader">
                <span class="customPageTitle">RGM Type</span>
            </div>
            <div class="ui-widget-content">
                <table cellpadding="0" cellspacing="0" class="display" id="RGMTypeTable">
                    <thead>
                        <tr>
                          <th>
                            </th>
                            <th>
                                No
                            </th>
                            <th>
                                RGM Type
                            </th>
                            <th>
                                is Nationwide
                            </th>
                            <th>
                                is Active
                            </th>
                            <th>
                                Last Modified Date
                            </th>
                            <th>
                                Last Modified By
                            </th>
                            <th>
                                Create Date
                            </th>
                            <th>
                                Create By
                            </th>
                          
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
        <br />
    </div>
    <div id="divdetail">
    </div>
    </div>
</asp:Content>
